<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib  prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>固定资产管理系统</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<meta name="MobileOptimized" content="320">
	<!-- BEGIN GLOBAL MANDATORY STYLES -->          
	<link href="${ctx}/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
	<!-- END GLOBAL MANDATORY STYLES -->
	<!-- BEGIN THEME STYLES --> 
	<link href="${ctx}/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/themes/light.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/custom.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-datetimepicker/css/datetimepicker.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/jquery-multi-select/css/multi-select.css" />
	<link href="${ctx }/css/custom.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx }/assets/plugins/jquery-file-upload/css/jquery.fileupload-ui.css" rel="stylesheet" />
	<link href="${ctx}/frontend/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>   
   	<link href="${ctx}/frontend/assets/css/pages/portfolio.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/frontend/assets/plugins/fancybox/source/jquery.fancybox.css" rel="stylesheet" />              
    <link rel="stylesheet" href="${ctx}/frontend/assets/plugins/revolution_slider/css/rs-style.css" media="screen">
    <link rel="stylesheet" href="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/css/settings.css" media="screen"> 
    <link href="${ctx}/frontend/assets/plugins/bxslider/jquery.bxslider.css" rel="stylesheet" />       
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-datepicker/css/datepicker.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-timepicker/compiled/timepicker.css" />
	<!-- END THEME STYLES -->	
	<link rel="shortcut icon" href="favicon.ico" />
</head>
<body class="page-header-fixed page-full-width">
	<!-- BEGIN HEADER -->
	<%@include file="../include/header.jsp" %>
	<!-- END HEADER -->
	
	<!-- BEGIN CONTAINER -->
	<div class="page-container">
		<!-- BEGIN PAGE -->
		<div class="page-content">			         
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title">
						资产报废（上传会议纪要）
					</h3>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->          
			<div class="row">
				<div class="col-md-12">					
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<br><br>
					<div class="row">
						<div class="form-group">
							<input type="hidden" id="bfIds" value="${bfIds }">
							<input type="hidden" id="jiYao">
							<label class="col-md-2 control-label" style="text-align:right;margin-top:10px">会议纪要</label>
							<div class="col-md-4" id="jiYaoList" style="margin-top:10px">
							</div>
							<div class="col-md-2">
								<a class="btn green" data-toggle="modal" href="#uploadFJ" id="upJiYao">上传会议纪要</a>
							</div>
							<div class="col-md-2"></div>
							<div class="col-md-2">
								<button type="button" id="tiJiao" class="btn blue">提交纪要</button>
							</div>
						</div>
					</div><br>
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption"><i class="fa fa-cogs"></i>待报废资产列表</div>
							<div class="tools">
								<a href="javascript:;" class="collapse"></a>								
							</div>
						</div>
						<div class="portlet-body flip-scroll">
							<form class="form-horizontal" id="baoFeiForm" role="form">
								<table class="table table-bordered table-striped table-condensed flip-content">
									<thead class="flip-content">
										<tr>
											<th>资产编号</th>
											<th>物资名称</th>
											<th>品牌</th>
											<th>规格型号</th>
											<th>购买日期</th>
											<th>报废月限</th>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${baoFeiList }" var="u">
											<tr>
												<td>${u.wuZi.ziChanBH }</td>
												<td>${u.wuZi.wuZiMC }</td>
												<td>${u.wuZi.pinPai }</td>
												<td>${u.wuZi.guiGeXH }</td>
												<td><fmt:formatDate value="${u.wuZi.gouMaiRQ }" pattern="yyyy-MM-dd"/></td>
												<td>${u.wuZi.baoFeiYX }</td>
											</tr>
										</c:forEach>
									</tbody>
								</table>
							</form>
						</div>
					</div>				
				</div>
			</div>			
			<!-- END PAGE CONTENT-->
		</div>
		<!-- END PAGE -->
	</div>
	<!-- END CONTAINER -->
	<!-- BEGIN FOOTER -->
	<%@include file="../include/footer.jsp" %>
	
	<div class="modal fade" id="uploadFJ" tabindex="-1" role="basic" aria-hidden="true">
		<div class="modal-dialog modal-wide">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
					<h4 class="modal-title">上传文件</h4>
				</div>
				<div class="modal-body" id="fileUploadBody">
				</div>
				<div class="modal-footer">
					<button type="button" class="btn blue" data-dismiss="modal">关闭</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<script id="template-upload" type="text/x-tmpl">
		{% for (var i=0, file; file=o.files[i]; i++) { %}
		    <tr class="template-upload fade">
		        <td>
		            <span class="preview"></span>
		        </td>
		        <td>
		            <p class="name">{%=file.name%}</p>
		            {% if (file.error) { %}
		                <div><span class="label label-danger">错误</span> {%=file.error%}</div>
		            {% } %}
		        </td>
		        <td>
		            <p class="size">{%=o.formatFileSize(file.size)%}</p>
		            {% if (!o.files.error) { %}
		                <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
		                <div class="progress-bar progress-bar-success" style="width:0%;"></div>
		                </div>
		            {% } %}
		        </td>
		        <td>
		            {% if (!o.files.error && !i && !o.options.autoUpload) { %}
		                <button class="btn blue start">
		                    <i class="fa fa-upload"></i>
		                    <span>上传</span>
		                </button>
		            {% } %}
		            {% if (!i) { %}
		                <button class="btn red cancel">
		                    <i class="fa fa-ban"></i>
		                    <span>取消</span>
		                </button>
		            {% } %}
		        </td>
		    </tr>
		{% } %}
	</script>
	<!-- The template to display files available for download -->
	<script id="template-download" type="text/x-tmpl">
		{% for (var i=0, file; file=o.files[i]; i++) { %}
		    <tr class="template-download fade">
		        <td>
		            <span class="preview">
		                {% if (file.thumbnailUrl) { %}
		                    <a href="${ctx}{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery>
		                    	<img src="{%=file.fileIcon%}" style="width:32px;height:32px;">
		                    </a>
		                {% } %}
		            </span>
		        </td>
		        <td>
		            <p class="name">
		                {% if (file.url) { %}
		                    <a href="${ctx}{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" ${ctx}{%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
		                {% } else { %}
		                    <span>{%=file.name%}</span>
		                {% } %}
		            </p>
		            {% if (file.error) { %}
		                <div><span class="label label-danger">错误</span> {%=file.error%}</div>
		            {% } %}
		        </td>
		        <td>
		            <span class="size">{%=o.formatFileSize(file.size)%}</span>
		        </td>
		        <td>
		            {% if (file.deleteUrl) { %}
		                <button onclick="delFuJian('{%=file.fuJianId%}','{%=file.type%}')" class="btn red delete" data-type="{%=file.deleteType%}" data-url="${ctx}{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
		                    <i class="fa fa-trash-o"></i>
		                    <span>删除</span>
		                </button>
		            {% } else { %}
		                <button class="btn yellow cancel">
		                    <i class="fa fa-ban"></i>
		                    <span>取消</span>
		                </button>
		            {% } %}
		        </td>
		    </tr>
		{% } %}
	</script>
	
	<script src="${ctx}/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>    
	<script src="${ctx}/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>  
	<script src="${ctx}/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/scripts/form-components.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/clockface/js/clockface.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-daterangepicker/moment.min.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
	<script type="text/javascript" src="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/js/jquery.themepunch.plugins.min.js"></script>
    <script type="text/javascript" src="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/js/jquery.themepunch.revolution.min.js"></script> 
    <script type="text/javascript" src="${ctx}/frontend/assets/plugins/bxslider/jquery.bxslider.min.js"></script>    
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery-multi-select/js/jquery.multi-select.js"></script>
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
    <script type="text/javascript" src="${ctx}/assets/plugins/select2/select2.min.js"></script>
    <script type="text/javascript" src="${ctx}/assets/plugins/fuelux/js/spinner.min.js"></script>
    <script src="${ctx}/assets/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script>
    <script src="${ctx }/assets/plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript" ></script>
    <script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/tmpl.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/load-image.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/canvas-to-blob.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.iframe-transport.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-process.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-image.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-audio.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-video.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-validate.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-ui.js"></script>
	<script src="${ctx }/js/form-fileupload.js"></script>
    <script src="${ctx}/frontend/assets/scripts/index.js"></script>
	<!-- END CORE PLUGINS -->
	<script src="${ctx}/assets/scripts/app.js"></script>
	<script>
		jQuery(document).ready(function() {       
		   // initiate layout and plugins
		   App.init();
		   FormComponents.init();
		});
		
		$('#upJiYao').click(function(){
			$.ajax({
				type:"POST",
				url:"${ctx}/wuzi/upJiYaoForm.do",
				data:{
					"bfIds":"${bfIds}"
				},
				dataType:"html",
				async:false,
				success:function(data){
					$('#fileUploadBody').html(data);
					FormFileUpload.init();
				}
			});
		});
		
		function upFuJian(id,ysWJM,type){
			if(type=="6"){
				var jiYao=$('#jiYao').val();
				jiYao=jiYao+id+",";
				$('#jiYao').val(jiYao);
				var result="<span id=\""+id+"\" style=\"font-size:14px\"><a href=\"${ctx }/wuzi/downloadFile.do?id="+id+"&type="+type+"\">"+ysWJM+"</a>&nbsp;&nbsp;<a href=\"javascript:delFuJian('"+id+"','"+type+"')\">X</a>&nbsp;&nbsp;</span>";
				$('#jiYaoList').append(result);
			}
		}
		
		function delFuJian(id,type){
			if(type=="6"){
				var jiYao=$('#jiYao').val();
				jiYao=jiYao.replace(id+",","");
				$('#jiYao').val(jiYao);
				$('#'+id).remove();
				$.ajax({
					type:"POST",
					url:"${ctx}/wuzi/delFuJian.do",
					data:{
						"id":id,
						"type":type
					},
					dataType:"html",
					async:false,
					success:function(data){
						
					}
				});
			}
		}
		
		$('#tiJiao').click(function(){
			$.ajax({
				type:"POST",
				url:"${ctx}/wuzi/faQiBaoFeiSave.do",
				data:{
					"bfIds":"${bfIds}",
					"jiYao":$('#jiYao').val()
				},
				dataType:"json",
				async:false,
				success:function(data){
					alert("提交会议纪要成功，等待固资管理部门领导审批！");
					window.opener.location.reload();
					window.close();
				}
			});
		});
	</script>
</body>
<!-- END BODY -->
</html>